﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.franchise.transactions {
    import Engine.Transactions.*;
    import Classes.*;

    public class TFranchiseSupply extends Transaction {

        private var m_franchise:String;
        private var m_neighbor:String;
        private var m_starRating:Number;
        private var m_result:Object;

        public function TFranchiseSupply(_arg1:String, _arg2:String, _arg3:Number){
            this.m_franchise = _arg1;
            this.m_neighbor = _arg2;
            this.m_starRating = _arg3;
            super();
        }
        override public function perform():void{
            signedCall("FranchiseService.onSupply", this.m_franchise, this.m_neighbor);
        }
        override protected function onComplete(_arg1:Object):void{
            var business:* = null;
            var result:* = _arg1;
            this.m_result = result;
            if (result == null){
                return;
            };
            var newStarRating:* = 0;
            try {
                newStarRating = result.star_rating;
            } catch(e:Error) {
                newStarRating = m_starRating;
            };
            if (newStarRating == this.m_starRating){
                return;
            };
            if (((((FranchiseViralManager.checkStarRatingEarned(this.m_starRating, newStarRating, 3)) || (FranchiseViralManager.checkStarRatingEarned(this.m_starRating, newStarRating, 4)))) || (FranchiseViralManager.checkStarRatingEarned(this.m_starRating, newStarRating, 5)))){
                business = Global.franchiseManager.getBusinessFromType(this.m_franchise);
                FranchiseViralManager.triggerFranchiseViralFeeds(FranchiseViralManager.VIRAL_STARRATINGINCREASED, this.m_franchise, this.m_neighbor, null, newStarRating, business);
            };
        }
        public function get franchiseType():String{
            return (this.m_franchise);
        }

    }
}//package Modules.franchise.transactions 
